package thread;

public class ThreadDemo3 {
    public static void main(String[] args) {
        //匿名内部内,继承线程
        Thread t1 = new Thread(){
            public void run(){
                for(int i=0;i<1000;i++){
                    System.out.println("你是谁呀");
                }
            }
        };
        //单独定义线程的,这里面表示的是Runnable接口被Lambda简写
        /*
        runnable是函数式接口,所以可以被lambda简写
        Runnable run = () ->{
            for(int i=0;i<1000;i++){
                System.out.println("在干嘛");
            }
        };
         */
        Thread t2 = new Thread(()-> {
            for (int i = 0; i < 1000; i++) {
                System.out.println("开门查水表的");
            }
        });
        t2.start();


    }
}
